#ifndef _CCAIROHELPER_H_
#define _CCAIROHELPER_H_

#include <buola/image/cpicture.h>

#define COLOR_MATRIX_9      1
#define COLOR_MATRIX_3H     2
#define COLOR_MATRIX_3V     3

namespace buola { namespace gui {

class CColorMatrix
{
public:
    unsigned int mRGB;
    CImageMatrix *mMatrix;
};

class CColorMatrixPool
{
public:
    void Init(int pType,img::CImage_rgba8 &&pI1,img::CImage_rgba8 &&pI2,img::CImage_rgba8 &&pI3);
    void Init(img::CImage_rgba8 &&pImage,const CRect_d &pRect);
    CImageMatrix *Get(const img::CColor&);

protected:
    int mType;
    img::CImage_rgba8 mI1,mI2,mI3;
    CRect_d mRect;
    std::vector<CColorMatrix*> mAll;
};

class CColorImage
{
public:
    unsigned int mRGB;
    img::CPicture mImage;
};

class CColorImagePool
{
public:
    void Init(const img::CPicture &mImage);
    img::CPicture Get(const img::CColor&);
    const img::CPicture &GetBase()   {   return mImage;              }
    CSize_d GetSize()       {   return mImage.Size();   }
protected:
    img::CPicture mImage;
    std::vector<CColorImage*> mAll;
};

class CCairoHelper
{
public:
    static img::CPicture LoadImage(int);
    static img::CPicture LoadImage(const std::wstring&);
    static img::CImage_rgba8 LoadImage2(int);
    static img::CImage_rgba8 LoadImage2(const std::wstring&);
    static CImageMatrix *LoadMatrix(const std::wstring&);
    static void InitMatrixPool(const std::wstring&,CColorMatrixPool&,bool=false,bool=false);
};

/*namespace gui */ } /*namespace buola*/ }

#endif

